<?php
namespace common\models;

use yii\base\Model;

class UploadForm extends Model
{

    public $imageFile;

    //制定规则
    public function rules()
    {
        return [
        [['imageFile'], 'file', 'skipOnEmpty' => false, 'extensions' => 'zip,jpg,gif,png'],
        ];
    }

    //上传
    public function upload()
    {
        $this->imageFile->saveAs(FRONT_PATH.'/uploads/' . $this->imageFile->baseName . '.' . $this->imageFile->extension);
        return true;
    }
}